Repository navigation
nav: dyn_bike's front slip in its wheel's frame, as dyn_4w's (f_eps = 0) - #852
Merged
Merged
Conversation
A golden for dyn_bike's port-Hamiltonian form, as DynBike.Golden is for the plant: tests/data/dyn_bike_ph_golden.json, written with CVC_DYN_BIKE_PH_GOLDEN_WRITE=1 and otherwise checked to 1e-9 relative. On DynBike.Golden's Humvee (lags, low-speed blend), at its seven states (cruising, a hard corner, trail braking, past the tire's peak, backing up, creeping, pulling away from rest) and a stop at the speed clamp, each case records: - the parts at its state (dyn_ph_parts_at): u, sg, Fxf, Fxr, Fyf, Fyr, wf, wr, w0f, the secants Sf and Sr, Dx, cos delta; - the rates at its state (dyn_ph_rates_at): dissipated, supplied, floor, grade; - one dyn_plant_books step: the next state, the twist before the limiters (dyn_step_free), and the books (dH, the trapezoid's dissipated, supplied, floor and grade, limiter, residual); - the gradient of a fixed weighting of the books on the state and the commands, by forward-mode duals. The test also checks that dyn_plant_books steps exactly as dyn_plant. DynBike.Golden and dyn_bike_golden.json are unchanged. nav_dyn_bike_test: 22 tests pass (MSVC 14.44 Release).
dyn_plant's front slip becomes the wheel-frame slip dyn_4w uses: alpha_f = -atan2(w_f, u_f), with w_f = cos(delta) (vy + lf r) - sin(delta) vx the front axle's sideways velocity in its wheel's frame (n_f^T v) and u_f its floored forward speed there. The secant is rooted at w_f = 0 (it was at u tan(sg delta), the floored speed's root). The rear's slip was already its wheel's frame's. The implicit step's Jacobian takes the front's d(Fyf cos delta)/d(vy, r) = -S_f cos^2(delta) (1, lf). So in the pH form: - R's front term is S_f n_f n_f^T (was (S_f / cos delta) n_f n_f^T), positive semi-definite at any delta; - f_eps, what the secants leave, is round-off: the speed floor enters only the slips' forward speeds. The floor line stays in the books. dyn_ph_parts gains uf (the front's forward speed) and loses w0f; dyn_ph_tangent_D takes the wheel-frame slip, its front sensitivity exact in (vy, r) (uf moves with them too). Tests (nav_dyn_bike_test, 23): - DynBikePH.TheFloorTermVanishesWithTheFloor becomes TheFloorTermIsRoundOff: |floor power| / (dissipated + |supplied| + 1 W) <= 2.2e-16 at every floor from 0.5 to 1e-9 m/s; - new DynBikePH.TheTangentIsTheTiresDerivative: dyn_ph_tangent_D against central differences of the tires' lateral force and moment, 1.4e-7 of its scale; - DynBike.Golden, DynBikePH.Golden and NavMaterialExt.Golden's dynamic case regenerated (material_ext_golden.json's surrogate and bicycle cases are byte-identical). Measured, before -> after: the kinematic-limit gap 0.01074 -> 0.01074; the vector field 1.62e-4 / 1.06e-4 m g -> the same; past-peak states 244 of 500 -> 244; the swerve's residual 3.83 / 3.92 / 3.95 per halving -> the same, |sum| / flow at hdt 0.01 1.21e-3 -> 1.21e-3; braking to a stop at hdt 0.01, limiter -353.5 J -> -358.2 J. dyn_power.h's dyn_tire_power keeps the old front slip angle.
transfix
added a commit
to CVC-Lab/GRL-SNAM
that referenced
this pull request
Oct 28, 2026
Follows transfix/libcvc#852: dyn_plant's front slip becomes the wheel-frame slip dyn4's tires use, alpha_f = -atan2(w_f, u_f) with w_f = cos(delta) (vy + lf r) - sin(delta) vx (n_f.v) and u_f the floored forward speed in the wheel's frame, its secant rooted at w_f = 0. The implicit step's Jacobian takes the front's -S_f cos^2(delta) (1, lf) on the body's y. In the pH twin, R's front term is S_f n_f n_f^T, f_eps is round-off, and DynPHParts gains uf and loses w0f. The three fixtures are regenerated by libcvc#852: dyn_bike_golden.json, dyn_bike_ph_golden.json, and material_ext_golden.json (its dynamic case; the surrogate and bicycle cases are byte-identical). Measured (torch 2.8 CPU), worst relative difference from libcvc: plant 0 (next state) and 2.8e-16 (gradient); pH parts 3.4e-16, rates 3.4e-16, books 7.1e-14, books gradient 4.4e-14. The floor power is at most 6e-13 W on the golden's cases. The swerve's residual still falls 3.94x / 3.97x per halving of the step.
…-frame-slip # Conflicts: # src/cvc/tests/data/dyn_bike_ph_golden.json # src/cvc/tests/nav_dyn_bike_test.cpp
transfix
added a commit
to CVC-Lab/GRL-SNAM
that referenced
this pull request
Oct 28, 2026
…852), and the pH twin (#138) The plant's front slip is now measured in its wheel's frame, as the four-wheel model's: alpha_w = -atan2(n_w.v, sqrt((t_w.v)^2 + eps^2)), each rooted at n_w.v = 0 (transfix/libcvc#852). The paper follows: - Section 3: the directions come first, then the slips in the wheels' frames; the old front slip is noted. - Lemma 1 holds at every steering angle (the secant through w = 0, slope P C B u_w / (u_w^2 + w^2) at the root); f_eps is the root branch's rounding only. - Section 4.2 and Proposition 1: R's front term is S_f n_f n_f^T, and the vehicle is passive from the drive port alone at every floor. - Section 4.4: S_f ~ C_f / u_f; the front tire's power is exactly its dissipation but for the root branch's rounding. - Section 4.5: the floor reaches only the slips' forward speeds; TheFloorTermIsRoundOff measures at most 2.2e-16 of the flow; the old remainder and its eps^2 numbers are kept as history. - Section 4.7: k_f is the wheel-frame slip's exact sensitivity (eq. kf), checked by the new TheTangentIsTheTiresDerivative (1.4e-7). - Section 5.2: braking limiter -358 J, residual 4e-6. - Section 10: the four-wheel form now carries the single track's over. - Tables: the plant table gains the renamed floor test and the tangent test, with #852's numbers; the live plant's rows move to their own table (the plant table no longer fit a page); the twins table and the GRL-SNAM validation rows gain #138's pH twin (test_dyn_bike_ph_parity, 18 passed, worst 7.1e-14). - Section 8.2-8.3, Python access and the equation-to-code map: the pH form's parts, rates and books are twinned in GRL-SNAM #138. - Appendix A: #852's and #138's branch commits, and the printed lines at 1a0acc77 with the c1f104c0 values they replace. - Versions: #852. Built with TeX Live pdflatex, three passes: 27 pages, no warnings.
transfix
added a commit
to CVC-Lab/GRL-SNAM
that referenced
this pull request
Oct 28, 2026
…t slip in its wheel's frame (#138) Two commits, for Joe to review before merging: 1. a torch twin of libcvc's single-track vehicle in port-Hamiltonian form, with its per-step energy books; 2. `dyn_bike`'s front slip moved into its wheel's frame, following libcvc. They sit beside `dyn_plant` in `grl_snam/dyn_bike.py`. The whitepaper (#137, `docs/vehicle-ph-plant.tex` §8.2–8.3 and §10) lists the twin as missing. **1. The pH twin** (held to libcvc's `DynBikePH.Golden`, transfix/libcvc#848). New in `grl_snam/dyn_bike.py`, mirroring libcvc's `dyn_ph_*` in `cvc/nav/detail/dyn_bike.h`: - `dyn_ph_parts_at`: everything the form is built from at a state: - the axle forces (the port); - the tires' lateral forces and secant stiffnesses; - `u`, `sg`, `uf` and `Dx`; - the vectors `n_f`, `n_r`, `t_f`, `t_r`. - `dyn_ph_rates_at`: the power balance dH/dt = supplied − dissipated + floor + grade. - `dyn_ph_hamiltonian`: ½ vᵀMv. - `dyn_plant_books`: `dyn_plant`'s step, unchanged, plus its books: - the trapezoid of the rates between the step's start (with the actuators' outputs δ₁, a₁) and the twist the step reached before its limiters; - `limiter`: dH across the speed clamp and the low-speed blend; - `residual`: the rest. - `dyn_plant(..., with_free=True)` also returns the pre-limiter twist (libcvc's `dyn_step_free`). - `dyn_plant`'s step 2 moves into `_axles`, which the parts share. `tests/test_dyn_bike_ph_parity.py` checks the twin against `dyn_bike_ph_golden.json`, double tier, 1e-9 relative, on eight Humvee cases. Each case checks: - the parts and the rates; - one step's next state, pre-limiter twist and books; - the autograd gradient of a weighting of the books against libcvc's forward-mode duals. The file also tests that a batch books like its rows. A torch-only gate checks that the books close to second order on a swerve. **2. The wheel-frame front slip** (follows transfix/libcvc#852, approved by Joe). The front slip becomes the wheel-frame slip `dyn4`'s tires use: - alpha_f = −atan2(w_f, u_f); - w_f = cos δ (vy + lf r) − sin δ vx, which is n_f·v; - u_f is the floored forward speed in the wheel's frame; - the secant is rooted at w_f = 0. The implicit step's Jacobian takes the front tire's −S_f cos² δ (1, lf) on the body's y. In the pH twin, R's front term becomes S_f n_f n_fᵀ, and f_ε is round-off. Three fixtures are regenerated from libcvc#852: - `dyn_bike_golden.json`; - `dyn_bike_ph_golden.json`; - `material_ext_golden.json`: only its dynamic case changes; the surrogate and bicycle cases are byte-identical. **Measured** (torch 2.8, CPU, after both commits): - Worst relative difference from libcvc: | Values | Worst relative difference | |---|---| | Plant next state | 0 | | Plant gradient | 2.8e-16 | | pH parts | 3.4e-16 | | pH rates | 3.4e-16 | | Books | 7.1e-14 | | Books gradient | 4.4e-14 | - On the golden's cases, the floor power is at most 6e-13 W. - On the swerve, the mean |residual| per step falls 3.94× and then 3.97× per halving of the step. - `test_dyn_bike_parity`, `test_dyn_bike_ph_parity`, `test_material_ext_parity`, `test_dyn4_parity` and `test_material_bike_parity` give 57 passed and 6 skipped. The skips are live-pycvc checks that this machine's pycvc lacks. - ruff and black are clean on the changed files. pycvc has no dynamic binding, so none of this depends on a pycvc release.
transfix
added a commit
to CVC-Lab/GRL-SNAM
that referenced
this pull request
Oct 28, 2026
… review fixes, links (#140) * docs(vehicle-ph-plant): reproduce appendix, steering as a modulation, review fixes, links - Appendix A: the exact setup behind every measured value (libcvc c1f104c0, MSVC 19.44, CMake 3.31.7, Ninja 1.12.1, cvcpkg 2.5.6, torch 2.8.0+cpu); the Windows commands that were run, with the extra CMake flags and why; the Linux/macOS equivalents (not run verbatim here; libcvc's CI runs the suites on every platform); each test's printed lines; GRL-SNAM's pytest line and its expected 53 passed, 2 skipped. - Section 6.6 rewritten for the learned plant's steering: the reference form books power through steering (13.4% of |y.u| on the golden fit; 5.6% on a fit to the analytic plant, which books none). The opt-in modulated form (transfix/libcvc#851) has D(v, delta) and G(v, delta), with the drive alone as the port. A new validation table holds its tests. - The learned plant's provenance corrected: public CVC-Lab/LieSPHGP has no SE(2) vehicle; the port and its golden follow an SE(2) package built on it at 65db994. LieSPHGP's own trainers use the EKF ELBO. - Review fixes: - the dynamic plant is 3.7.0 (#714), the learned plant 3.7.1 (#758); - psi for the kinematic heading (theta is the grade); - a "mixed" parity tier; - the sharp check's wording and its 3.5e-5; - the health-check range; - test totals, the CTest regex and NavPotential.DriveForce*; - the GRL-SNAM paper's full title. - Links from README.md and the guide's "See also". pdflatex: 26 pages, three passes, no warnings. * docs(vehicle-ph-plant): the front slip in its wheel's frame (libcvc #852), and the pH twin (#138) The plant's front slip is now measured in its wheel's frame, as the four-wheel model's: alpha_w = -atan2(n_w.v, sqrt((t_w.v)^2 + eps^2)), each rooted at n_w.v = 0 (transfix/libcvc#852). The paper follows: - Section 3: the directions come first, then the slips in the wheels' frames; the old front slip is noted. - Lemma 1 holds at every steering angle (the secant through w = 0, slope P C B u_w / (u_w^2 + w^2) at the root); f_eps is the root branch's rounding only. - Section 4.2 and Proposition 1: R's front term is S_f n_f n_f^T, and the vehicle is passive from the drive port alone at every floor. - Section 4.4: S_f ~ C_f / u_f; the front tire's power is exactly its dissipation but for the root branch's rounding. - Section 4.5: the floor reaches only the slips' forward speeds; TheFloorTermIsRoundOff measures at most 2.2e-16 of the flow; the old remainder and its eps^2 numbers are kept as history. - Section 4.7: k_f is the wheel-frame slip's exact sensitivity (eq. kf), checked by the new TheTangentIsTheTiresDerivative (1.4e-7). - Section 5.2: braking limiter -358 J, residual 4e-6. - Section 10: the four-wheel form now carries the single track's over. - Tables: the plant table gains the renamed floor test and the tangent test, with #852's numbers; the live plant's rows move to their own table (the plant table no longer fit a page); the twins table and the GRL-SNAM validation rows gain #138's pH twin (test_dyn_bike_ph_parity, 18 passed, worst 7.1e-14). - Section 8.2-8.3, Python access and the equation-to-code map: the pH form's parts, rates and books are twinned in GRL-SNAM #138. - Appendix A: #852's and #138's branch commits, and the printed lines at 1a0acc77 with the c1f104c0 values they replace. - Versions: #852. Built with TeX Live pdflatex, three passes: 27 pages, no warnings. * docs(vehicle-ph-plant): cite #138's squash commit 2f76ab0 The #138 rows, the reproduction appendix and the versions table now cite main at 2f76ab0, where the dynamic twins' parity tests pass again (57 passed, 6 skipped for pycvc). The PDF is rebuilt: 27 pages, no warnings. * docs(vehicle-ph-plant): the point-mass books' twin (#139) and pycvc's tick telemetry (libcvc #857) - Table 9 (the twins) gains the navigator's point-mass books: book_step, energy_residual_bound, material_energy and integrate_surrogate_material's books hook, held to libcvc's NavPotential.BooksGolden. book_step on libcvc's arguments is held to 1e-12 (double tier); the books are held to 1e-5 of the step's bound, and 2e-5 on the clamped rollout (float tier). - 8.3, "What is not twinned yet": the point-mass books are twinned. The tick telemetry is a running world's, so it has no twin; libcvc #857 binds it in pycvc (nav_sim_world_set_capture_drive_telemetry, nav_sim_world_drive_telemetry). - 8.4 gains "Book the navigator's energy": how to ask for the books, the measured parity (1.1e-6 and 8.3e-8 of the bound), and the curved-patch caveat. On a patch whose gradient channels are not its values' gradients, each step books the force/-grad U gap, which fills 99.65% of the bound at h = 0.002. It also says where a live world's context work comes from. - 10, "Python access", and the equation-to-code map: updated to match. PDF rebuilt with TeX Live pdflatex, three passes: 28 pages, no warnings.
transfix
added a commit
that referenced
this pull request
Oct 28, 2026
The project version and the cvcpkg recipe family move to 3.7.2. Every recipe is at cvc_revision 1 already, so none restarts. 3.7.2 carries the dynamic plants on the terrain and in a Jolt world, and the four-wheel plant (#869): --plant dynamic and dynamic4w drive the ground, collide with the buildings and each other, and book the collisions. It also carries dyn_4w's port-Hamiltonian form (#850), dyn_bike's wheel-frame front slip (#852), the books goldens for GRL-SNAM's twins (#848, #849), pycvc's drive telemetry (#857) and keep-alives (#864), the macOS SDK's openssl (#846), and the state_exec scheduler and evaluator work (#842, #843, #844, #861, #863).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows #848 (merged as 9b9270b; master is merged in, so the diff is the switch alone). Please review before merging; auto-merge is off.
The front slip of
dyn_bikebecomes the wheel-frame slip thatdyn_4wuses (approved by Joe):The front secant is now rooted at w_f = 0. Before, it was rooted at the floored speed's root, u tan(sg δ). The rear slip was already in its wheel's frame.
The implicit step's Jacobian takes the front tire's d(F_yf cos δ)/d(vy, r) = −S_f cos² δ (1, lf), as
dyn_4w's does.The pH form
floorline stays indyn_ph_rates,dyn_ph_booksanddyn_bike_books, so their APIs don't change.dyn_ph_partsgainsufand losesw0f.dyn_ph_tangent_Dtakes the wheel-frame slip. Its front sensitivity is exact in (vy, r), including the forward speed's dependence, which runs along the same (1, lf).Tests (
nav_dyn_bike_test, 23 tests)DynBikePH.TheFloorTermVanishesWithTheFloorbecomesTheFloorTermIsRoundOff. |floor power| / (dissipated + |supplied| + 1 W) is ≤ 2.2e-16 at every floor from 0.5 to 1e-9 m/s. Before, it was 5.35e-4 at 0.5 m/s.DynBikePH.TheTangentIsTheTiresDerivativechecksdyn_ph_tangent_Dagainst central differences of the tires' lateral force and moment. Worst error: 1.4e-7 of its scale.DynBike.Golden;DynBikePH.Golden(the keyw0fbecomesuf);NavMaterialExt.Golden's dynamic case. Its surrogate and bicycle cases stay byte-identical.Measured, before → after (MSVC 14.44 Release)
DynBike.KinematicLimitFollowsBikeStep)physics_dyn_bike_plant_test, Humvee: floor / residual sharephysics_dyn_bike_plant_test, RoboRacer: residual sharenav_dyn_4w_testsingle-track limitAlso passing locally:
nav_bindingnav_dyn_4wnav_material_bike_rolloutnav_material_extphysics_dyn_bike_plantphysics_plant_hostnav_sim_worldnav_plant,physics_plant_log,nav_coef_trainandnav_potentialwere still running when this was opened.GRL-SNAM follows in CVC-Lab/GRL-SNAM#138, which brings the torch
dyn_bike.pyand the three fixtures over. It matches the new goldens to 2.8e-16 on the plant and 7.1e-14 on the books.Not changed:
dyn_power.h'sdyn_tire_powerstill uses the old front slip angle, sg δ − atan2(vy + lf r, u). Its tire-slip power therefore no longer reads the plant's own front slip. It wasn't part of the approved switch, and changing it moves the fitted power model, so it's left for a decision.